import { onBeforeMount, onMounted, reactive } from 'vue';

export default () => {
  const point = reactive({
    x: 0,
    y: 0,
  });

  function getPoint(event) {
    point.x = event.pageX;
    point.y = event.pageY;
  }

  onMounted(() => {
    window.addEventListener('click', getPoint);
  });

  onBeforeMount(() => {
    window.addEventListener('click', getPoint);
  });
  return point;
};
